[#555] Persist language filter in localStorage#557
Conversation
Save selected language to localStorage on filter change and restore it on revisit when no lang param is in the URL. Defaults to "all" when no saved preference exists. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
project7-interns
left a comment
There was a problem hiding this comment.
LGTM. Clean localStorage persistence — URL params correctly take precedence over saved preference, saved values validated against LANGUAGES list, unnecessary redirects avoided when saved=all, and try/catch handles environments without localStorage.
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The localStorage restore logic cannot distinguish a missing lang param from an explicit ?lang=all, so it overrides valid explicit links with the saved preference.
Findings
- [medium]
FilterBarrestoresplotlink_langwhenever the normalizedlangprop isall, butsrc/app/page.tsxalready normalizes both a missinglangparam and an explicit?lang=allto the samelang="all"prop. That means a user who intentionally opens/?lang=allwill still be redirected to their saved language, which violates the ticket scope of restoring only when there is nolangURL param.- File:
src/components/FilterBar.tsx:58 - Suggestion: Pass a separate boolean or raw search-param signal down from
src/app/page.tsxso the restore effect only runs when the URL truly omittedlang.
- File:
Decision
Request changes until the restore logic can tell no lang param apart from an explicit ?lang=all.
Use window.location.search to detect whether lang was explicitly provided in the URL. Only restore localStorage preference when the param is truly absent, not when explicitly set to "all". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The restore effect now checks the raw URL for a lang param before applying the saved preference, so explicit ?lang=all links are no longer overridden.
Findings
- None.
Decision
Approve. The requested behavior is covered. Residual risk: GitHub checks were still in progress at review time.
Summary
Fixes #275
Saves the user's language filter selection to localStorage and restores it on revisit.
localStorage.plotlink_langlangURL param (default "all"), reads saved preference and applies it viarouter.replaceLANGUAGESlist before applyingTest plan
?lang=Frenchshould override saved preference🤖 Generated with Claude Code